package com.sgam.mf.domain.ref;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.OrderColumn;
import javax.persistence.Transient;

import org.codehaus.jackson.map.annotate.JsonDeserialize;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.springframework.format.annotation.DateTimeFormat;

import com.sgam.utils.CustomDateDeserializer;
import com.sgam.utils.CustomDateSerializer;

@MappedSuperclass
public class AbstractRefEntity  implements Comparable<AbstractRefEntity> {

	@Id
	@Column(name = "ID" )
	@GeneratedValue
	private Integer id;

	@Transient
	private String nlsValue;

	@Column(name = "MD_VALUE")
	private String mdValue;

	@Column(name = "RU_VALUE")
	private String ruValue;

	@Column(name = "EN_VALUE")
	private String enValue;

	@JsonSerialize(using = CustomDateSerializer.class)
	@JsonDeserialize(using = CustomDateDeserializer.class)
	@DateTimeFormat(pattern="dd.MM.yyyy")
	@Column(name = "END_DATE")
	private Date endDate;

	@Column(name = "STATUS")
	private Integer status;

	@Column(name = "UPDATED_BY_FK")
	private Integer updatedBy;

	
	@JsonSerialize(using = CustomDateSerializer.class)
	@JsonDeserialize(using = CustomDateDeserializer.class)
	@DateTimeFormat(pattern="dd.MM.yyyy")
	@Column(name = "UPDATED_DATE")
	private Date updatedDate;


	public Integer getId() {
		return id;
	}


	public void setId(Integer id) {
		this.id = id;
	}


	public String getNlsValue() {
		return nlsValue;
	}


	public void setNlsValue(String nlsValue) {
		this.nlsValue = nlsValue;
	}


	public String getMdValue() {
		return mdValue;
	}


	public void setMdValue(String mdValue) {
		this.mdValue = mdValue;
	}


	public String getRuValue() {
		return ruValue;
	}


	public void setRuValue(String ruValue) {
		this.ruValue = ruValue;
	}


	public String getEnValue() {
		return enValue;
	}


	public void setEnValue(String enValue) {
		this.enValue = enValue;
	}


	public Date getEndDate() {
		return endDate;
	}


	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}


	public Integer getStatus() {
		return status;
	}


	public void setStatus(Integer status) {
		this.status = status;
	}


	public Integer getUpdatedBy() {
		return updatedBy;
	}


	public void setUpdatedBy(Integer updatedBy) {
		this.updatedBy = updatedBy;
	}


	public Date getUpdatedDate() {
		return updatedDate;
	}


	public void setUpdatedDate(Date updatedDate) {
		this.updatedDate = updatedDate;
	}


	@Override
	public int compareTo(AbstractRefEntity o) {
		return getMdValue().compareToIgnoreCase(o.getMdValue());
	}

}
